package cn.uestc.labhms.modules.hms.controller;

import cn.uestc.labhms.common.annotation.SysLog;
import cn.uestc.labhms.common.utils.R;
import cn.uestc.labhms.modules.hms.entity.Vo.CommonConditionVo;
import cn.uestc.labhms.modules.hms.entity.Vo.SetCommonConditionVo;
import cn.uestc.labhms.modules.hms.service.ConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
public class ConditionController {
    @Autowired
    private ConditionService conditionService;
    @GetMapping("/get/hms_Chi_Eng/all/conditions")
    public R getAllConditions() {
        CommonConditionVo allConditions = conditionService.getAllConditions();
        return R.ok().put("data", allConditions);
    }
    @GetMapping("/get/hms_common_condition/fields")
    public R getCommonCondition(){
        CommonConditionVo commonConditions = conditionService.getCommonConditions();
        return R.ok().put("data", commonConditions);
    }

    @PostMapping("/put/hms_common_condition/fields")
    @SysLog("设置常用查询条件")
    public R setCommonCondition(@RequestBody SetCommonConditionVo setCommonConditionVo){
        conditionService.setCommonConditions(setCommonConditionVo.getConditions());
        return R.ok();
    }
}
